__powerline() {
    if ! type __git_ps1 >/dev/null 2>&1 && [ -f "$HOME/.git-prompt.sh" ]; then
       source "$HOME/.git-prompt.sh"
    fi

    ps1() {
        if [ $? -eq 0 ]; then
            local FG_EXIT="\[\033[0;37m\]"
        else
            local FG_EXIT="\[\033[0;31m\]"
        fi
        PS1="\n\[\033[32m\]\u@\h "
        PS1+="\[\033[33m\]\w"
        if type __git_ps1 >/dev/null 2>&1; then
            PS1+="\[\033[36m\]$(__git_ps1)\n"
        else
            PS1+="\n"
        fi
        PS1+="$FG_EXIT$ \[\033[0m\]"
    }
    PROMPT_COMMAND=ps1
}

__powerline
unset __powerline
